#include <stack>
#include <queue>
int Compare_stack_queue(std::stack<int> *s, std::queue<int> *q);

void reverse_stack(std::stack<int> *s, std::stack<int> *t)
{
    if(s->empty())return;
    t->push(s->top());
    s->pop();
    reverse_stack(s,t);
}

int check(std::stack<int> *s, std::queue<int> *q)
{
    if(s->empty()&&q->empty())return 1;
    if(s->top()==q->front())
    {
        s->pop();
        q->pop();
        return check(s,q);
    }
    else return 0;
}

int Compare_stack_queue(std::stack<int> *s, std::queue<int> *q)
{
    // TODO
    if(s==NULL&&q==NULL)return 1;
    if(s->size()!=q->size())return 0;
    std::stack<int> *t=new std::stack<int>();
    reverse_stack(s,t);
    return check(t,q);
}